<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <!-- 满足有些用户在手机端访问的需要 -->

    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <title>用户管理</title>
    <!-- 线上环境 -->
    <link rel="stylesheet" href="/static/css/dist/component-min.css">
    <link rel="stylesheet" href="/static/plugins/jbox/jbox-min.css">

    <!--vue-->
    <script src="/static/vue/vue.js"></script>
    <!--element ui-->
    <script src="/static/element/index.js"></script>
    <link rel="stylesheet" href="/static/element/index.css">
    <style>
        .el-table__empty-block {
            height: 0;
        }
    </style>

</head>
<body class="cp-bodybox">
<div id="app">
    <#include "/common/header-fg.html" />

    <div class="container">
        <div class="inner clearfix">
            <#include "/common/left-menu-fg.html" />

            <div class="content-right">
                <h1 class="content-right-title">订单详情</h1>
                <div>
                    <el-card class="box-card">
                        <div slot="header" class="clearfix">
                            <span style="line-height: 36px;">基本信息</span>
                        </div>
                        <el-form :inline="true" ref="form2" :model="form2" label-width="80px">
                            <el-row>
                                <el-col :span="6">
                                    <el-form-item label="订单号 :">
                                        {{detail.orderCode}}
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="客户 :">
                                        {{detail.customerNick}}
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="是否会员 :">
                                        {{isVip}}
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="状态 :">
                                        {{orderStatus}}
                                    </el-form-item>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="6">
                                    <el-form-item label="实际支付 :">
                                        {{detail.amount}}
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="下单时间 :">
                                        {{detail.createTime}}
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="付款时间 :">
                                        {{detail.payTime}}
                                    </el-form-item>
                                </el-col>
                                <el-col :span="6">
                                    <el-form-item label="总金额 :">
                                        {{detail.amount}}
                                    </el-form-item>
                                </el-col>
                            </el-row>
                        </el-form>
                    </el-card>
                    <el-card class="box-card" style="margin-top: 10px">
                        <div slot="header" class="clearfix">
                            <span style="line-height: 36px;">商品信息</span>
                        </div>
                        <template>
                            <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
                                <el-tab-pane label="商家订单" name="first">
                                    <el-card class="box-card" style="margin-top: 10px">
                                        <el-table
                                                :data="orderList"
                                                border
                                                style="width: 100%">
                                            <el-table-column
                                                    type="index"
                                                    label="行号"
                                                    width="80">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="orderCode"
                                                    label="订单号"
                                                    width="210">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="orgName"
                                                    label="商家">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="amount"
                                                    label="总金额（元）">
                                            </el-table-column>
                                            <el-table-column
                                                    prop="statusName"
                                                    label="订单状态">
                                            </el-table-column>
                                            <el-table-column
                                                    align="center"
                                                    label="操作"
                                                    inline-template>
                                                <div style="margin-left: -10px">
                                                    <el-dropdown>
                                                        <el-button size="small" type="primary">
                                                            操作<i class="el-icon-caret-bottom el-icon--right"></i>
                                                        </el-button>
                                                        <el-dropdown-menu slot="dropdown" align="center">
                                                            <el-dropdown-item v-if="isPermission('order:sysItemList', user.permissions)"><el-button size="mini" type="primary" class="el-icon-edit" @click.native="orderDetail(row.id)">详情</el-button></el-dropdown-item>
                                                            <el-dropdown-item><el-button size="mini" type="primary" class="el-icon-edit" @click.native.prevent="toldOrg(row.id)">通知商家</el-button></el-dropdown-item>
                                                        </el-dropdown-menu>
                                                    </el-dropdown>
                                                </div>
                                            </el-table-column>
                                        </el-table>
                                    </el-card>
                                </el-tab-pane>
                                <el-tab-pane label="付款详情" name="second">
                                    <template v-if="payDetail !== null">
                                        <el-form ref="form" :model="form" label-width="140px">
                                            <el-form-item label="付款时间">
                                                {{payDetail.payTime}}
                                            </el-form-item>
                                            <el-form-item label="积分支付">
                                                {{payDetail.costPoint}}
                                                <template v-if="payDetail.pointPay !== 0">（使用积分{{payDetail.pointPay}}）</template>
                                            </el-form-item>
                                            <el-form-item label="余额支付">
                                                {{payDetail.balancePay}}
                                            </el-form-item>
                                            <el-form-item label="微信支付">
                                                {{payDetail.amount}}
                                            </el-form-item>
                                            <el-form-item label="微信支付流水号" style="width:200px;" >
                                                {{payDetail.externalPayNo}}
                                            </el-form-item>
                                            <el-form-item label="微信支付账号">
                                                {{payDetail.externalUid}}
                                            </el-form-item>
                                        </el-form>
                                    </template>
                                </el-tab-pane>
                                <el-tab-pane label="发货详情" name="third">
                                    <el-tabs name="shipLogisticsDetail" type="card" value="0">
                                        <template v-for="(item, index) in shipLogisticsDetail">
                                            <el-tab-pane :label="item.orgName" :name="index + ''">
                                                <el-form :inline="true" label-width="80px">
                                                    <el-row>
                                                        <el-col :span="6">
                                                            <el-form-item label="订单号 :">
                                                                {{item.orderCode}}
                                                            </el-form-item>
                                                        </el-col>
                                                        <el-col :span="6">
                                                            <el-form-item label="发货时间 :">
                                                                {{item.insertTime}}
                                                            </el-form-item>
                                                        </el-col>
                                                        <el-col :span="6">
                                                            <el-form-item label="快递商家 :">
                                                                {{item.logisticsCompany}}
                                                            </el-form-item>
                                                        </el-col>
                                                        <el-col :span="6">
                                                            <el-form-item label="快递单号 :">
                                                                {{item.logisticsTrackingNo}}
                                                            </el-form-item>
                                                        </el-col>
                                                    </el-row>
                                                </el-form>
                                                <div style="padding-left: 100px">
                                                    <template v-for="log in shipTraceList[index]">
                                                        <span>{{log.acceptTime}}&nbsp;&nbsp;&nbsp;{{log.acceptStation}}</span><br>
                                                    </template>
                                                </div>
                                            </el-tab-pane>
                                        </template>
                                    </el-tabs>
                                </el-tab-pane>
                            </el-tabs>
                        </template>
                    </el-card>
                </div>
            </div>
            <!-- end content-right -->

            <a href="javascript:;" class="btn-leftMenuFold" id="j-btn-leftMenuFold"></a>
        </div>
    </div>
    <!-- end container -->

    <!--gonggao-->

    <!--tip-->
    <div class="footer">© 2017 , Inc. All rights reserved.</div>
    <!-- end footer -->
    <div class="fixedBar" style="right: -78px;">
        <ul>
            <template v-for="(item, index) in leftMenuList">
                <li v-if="index==0" :class="'shopManager' + index + ' cur'"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
                <li v-else :class="'shopManager' + index"><a href="javascript:;" :data-target="'#shop_' + index">{{item.groupName}}</a></li>
            </template>
        </ul>
        <a href="javascript:;" class="fixedBar-btn" id="j-fixedBar-btn"></a>
    </div>
    <a href="#" id="j-gotop" class="gotop" title="回到顶部" style="left: 1920.59px;"></a>

</div>
<script src="/static/js/dist/lib-min.js"></script>
<script src="/static/js/dist/list.js"></script>
<script src="/static/js/dist/component-min.js"></script>

<!-- 引入api -->
<script src="/static/js/api.js"></script>
<script>
    new Vue({
        el: '#app',
        mounted () {
            let that = this
            this.parseShipTrace()
        },
        data: function(){
            return {
                user: ${(user)!'null'},
                detail: ${(detail)!''},
                orderList: ${(orderList)![]},
                payDetail: ${(payDetail)!''},
                shipLogisticsDetail: ${(shipLogisticsDetail)![]},
                shipTraceList: [],
                currentPage: list.currentPage,
                pageSize: list.pageSize,
                totalCount: 0,
                form:{},
                form2: {},
                activeName2: 'first',
                headerNavList: list.headerNavList,
                accountNavList: list.accountNavList,
                leftMenuList: list.menu
            }
        },
        computed: {
            orderStatus () {
                if (this.detail.status === -1) {
                    return '取消'
                } else if (this.detail.status === 1) {
                    return '待付款'
                } else if (this.detail.status === 2) {
                    return '待发货'
                } else if (this.detail.status === 3) {
                    return '待收货'
                } else if (this.detail.status === 4) {
                    return '已确认'
                }
            },
            isVip () {
                if (this.detail.vip === 0) {
                    return '否'
                } else if (this.detail.vip === 1) {
                    return '是'
                }
            }
        },
        methods: {
            parseShipTrace () {
                let that = this
                this.shipTraceList = []
                this.shipLogisticsDetail.forEach(function (item) {
                    if (item.traces !== null && item.traces !== '' && item.traces !== undefined) {
                        let obj = JSON.parse(item.traces)
                        that.shipTraceList.push(obj)
                    }
                })
            },
            toldOrg (id) {
                let that = this;
                let loading = this.$loading({fullscreen: true, lock: true});
                this.http("/order/notify/org", {id: id}, function (res) {
                    if (res.status === 200) {
                        loading.close();
                        that.$alert('商家已收到短信提示','提示',{
                            confirmButtonText:'确定',
                        })
                    } else {
                        loading.close();
                        that.$alert(res.errMsg,'提示',{
                            confirmButtonText:'确定',
                        })
                    }
                }, function (res) {
                    loading.close();
                    that.$alert(res.errMsg,'提示',{
                        confirmButtonText:'确定',
                    })
                })
            },
            handleCurrentPageChange(val) {
                this.currentPage = val
            },
            next () {
                if (this.active++ > 2) this.active = 1;
            },
            previous () {
                if (this.active-- < 1) this.active = 1;
            },
            handleClick(tab, event) {
                console.log(tab, event);
            },
            orderDetail(orderId) {
                window.location.href = '/order/sysItemDetail?orderId=' + orderId
            }
        }
    })
</script>

<!-- 20170105 --></body>
</html>